mxstartup: Run startstop commands as transient user services #544
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Attempt to run startstop commands inside a user service unit. First make sure that a user service manager is running ("systemctl start user@UID") then start the startstop from this service manager as a transient service ("systemd-run --user").
It that doesn't seem to work, fall back to the previous ("su -c ... &") mechanism.
Running the startstop commands as a user service unit has the advantage that the execution environment of the startstop command is disconnected from the execution environment of the process calling mxtstartup.
Additionally, the startstop command can use the service manager to manage its own services:
Output of the startup script and additional services goes to the journal and is visible to the user. Note, that this is not true for some old accounts which have a UID < 1000 which are regarded system users by journald systemd and don't get an individual journal log file with an acl on it to give the user read access.